from typing import *
class Solution:
    def rotate(self, nums: List[int], k: int) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        tmp = nums[0]
        for i in range(len(nums)-1):
            if i <k:
                j = (i + k) % len(nums)
                print(j)
                nums[i], nums[j] = nums[j],nums[i]
            else:
                print(i, i+1)
                nums[i],nums[i+1] =nums[i+1], nums[i]
            print("nums=",nums)
        print(nums)

#print(Solution().rotate([1,2,3,4,5,6,7], 3))
print(Solution().rotate([1,2,3,4,5,6], 2))

#                0, 1, 2, 3, 4, 5, 6
# 需要转变成索引 4, 5, 6, 0, 1, 2, 3
# len(nums) - k + index
